
if [ "$#" -ne 1 ]; then
    echo "请在$0后面写上镜像名称"
    exit 1
fi
echo "开始执行脚本"
if [ ! -e Dockerfile ]; then
    echo "Dockerfile文件不存在"
    exit 1
fi
IMAGE_NAME=$1
echo "正在构建..."
docker build -t "$IMAGE_NAME" .
echo "正在保存..."
docker save "$IMAGE_NAME" -o "$IMAGE_NAME".tar
echo "正在压缩..."
gzip "$IMAGE_NAME".tar
echo "脚本执行完成"